import Vue from 'vue'
import VueRouter from 'vue-router'


Vue.use(VueRouter)
import home from '../views/home'
import shopcart from '../views/shopcart'
import member from '../views/member'
import search from '../views/search'
import newslist from '../views/news/newslist'
import newsinfo from '@/views/news/newsinfo'
import photolist from '../views/photo/photolist'
import photoinfo from '../views/photo/photoinfo'
import  goodslist from '../views/goods/googslist'
import goodsinfo from  '../views/goods/goodsinfo'
//  ./表示同级目录   ../表示上一级目录   /表示下一级目录  @表示src目录,vue-cli在设计时候设置的
//$route 是路由映射表有关方法 。pramars .query
const routes = [ //路由的映射表，一个地址，对应一个组件
    {path:'/',redirect:'/home'},
    {path:'/home',component:home},
    {path:'/shopcart',component:shopcart},
    {path:'/member',component:member},
    {path:'/search',component:search},
    {path:'/home/newslist',component:newslist},
    {path:'/home/newslist/newsinfo/:id',component:newsinfo,props:true},
    {path:'/home/photolist',component:photolist},
    {path:'/home/photoinfo/:id',component:photoinfo,props:true},
    {path:'/home/goodslist',component:goodslist,name:'shangpin'},
    {path:'/home/goodsinfo/:id',component:goodsinfo,name:'info',props:true}
]

const router = new VueRouter({
  routes,
    linkActiveClass:'active'
})

export default router
